package com.zaprk.service.impl;

import com.github.pagehelper.PageHelper;
import com.zaprk.mapper.IRankingMapper;
import com.zaprk.pojo.Ranking;
import com.zaprk.service.IRankingService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @PackageName: com.zaprk.service.impl
 * @ClassName: RankingServiceImpl
 * @Description:
 * @author: RZS
 * @date: 2022/10/11  16:35
 */
@Service
public class RankingServiceImpl implements IRankingService {

    @Autowired
    private IRankingMapper rankingMapper;

    @Override
    public List<Ranking> findAll(Integer page, Integer size) {

        /**
         *      在执行分页查询语句前执行PageHelper.startPage(page, size)方法
         * 即可实现分页查询。
         * startPage(起始页码, 每页显示数量)
         */
        // 设置分页参数; pageNum:页码, pageSize:每页大小

        PageHelper.startPage(page, size);

        // 执行查询数据操作
        List<Ranking> lists = rankingMapper.selectAll();

        return lists;
    }
}
